package wusiyuan.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import entity.User_Address;
import util.C3P0Util;
import wusiyuan.dao.AddTheAddressDao;

public class AddTheAddressDaoImpl implements AddTheAddressDao {

	@Override
	public Integer addAddress(User_Address ua) {		
		QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());	
		String sql = "insert  into user_addr  values(null,?,?,?,?,?,?,?,?,?,?,?,?)";
		Integer i=0;
		Object[] prams={ua.getUserId(),ua.getConsignee(),ua.getPhone(),ua.getZip_code(),ua.getSex(),
				ua.getProvince(),ua.getCity(),ua.getDistrict(),ua.getAddress(),
				ua.getRemark(),ua.getIs_default(),ua.getModified_time()};		
		try {
			i = qr.update(sql, prams);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return i;
	}


}
